package net.code.btalk.ui;

import net.code.btalk.BTalk;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.container.MainScreen;

public class BuddyScreen extends MainScreen {
	public static BTalk btalk;
	
	public BuddyScreen(BuddyListField l) {
		this.setTitle("Contacts");
		this.add(l);
		
		// add exit menuitem
		this.addMenuItem(new MenuItem("Log out & Exit", 0x0001000, 0) {
			public void run() {
				if (btalk.state == BTalk.STATE_LOGIN) {
					btalk.logoffJxa();
				}
				btalk.exitBtalk();
			}
		});
		
		this.addMenuItem(new MenuItem("Options", 0, 0) {
			public void run() {
				btalk.pushScreen(new OptionScreen());
			}
		});
		
	}
	
	public boolean onClose() {
		btalk.requestBackground();
		return true;
	}
}
